//
//  RMMOrderJiShiView.m
//  Romomo
//
//  Created by puman on 2017/2/21.
//  Copyright © 2017年 mazegong. All rights reserved.
//

#import "RMMOrderJiShiView.h"

@implementation RMMOrderJiShiView
{
    UIImageView *_imageV;
    UILabel *_nameLabel;
    NSString *_phone;
}
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        self.backgroundColor = kCColor;
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 10, self.width, 49)];
        view.backgroundColor = kWhiteColor;
        [self addSubview:view];
        
        _imageV = [[UIImageView alloc] initWithFrame:CGRectMake(15, 7, 30, 30)];
        _imageV.layer.masksToBounds = YES;
        _imageV.layer.cornerRadius = 15;
        [view addSubview:_imageV];
        
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(_imageV.right + 10, 0, 150, 44)];
        _nameLabel.font = kFont(16);
        _nameLabel.textColor = COLORFROMCODE(0x2B2B2B, 1);
        [view addSubview:_nameLabel];
        
        _but = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _but.frame = CGRectMake(kScreenWideth - 75, 0, 60, 44);
        _but.titleLabel.font = kFont(14);
        [_but setTitle:@"联系她" forState:(UIControlStateNormal)];
        [_but setTitleColor:kBasicColor forState:(UIControlStateNormal)];
        [view addSubview:_but];
    }
    return self;
}
- (void)setDic:(NSDictionary *)dic{
    if (![dic[@"EMP_IMAGE"] isKindOfClass:[NSDictionary class]]) {
        [RMMFileManager MBProgressWith:@"数据出现错误!" onView:self];
        return;
    }
    NSString *name = [RMMFileManager retrunObjWith:dic[@"EMP_IMAGE"][@"EMP_NAME"]];
    _nameLabel.text = [NSString stringWithFormat:@"%@ 为您服务",name];
    [_imageV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kBaseImageUrl,[RMMFileManager retrunObjWith:dic[@"EMP_IMAGE"][@"EMP_IMAGE_URL"]]]] placeholderImage:[UIImage imageNamed:@"加载中@3x"]];
    [RMMFileManager changeLabelTextColorOneWithLabel:_nameLabel forRange:NSMakeRange(0, name.length) byColor:kBasicColor];
}
    /*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
